package com.sikaryofficial.backend.domain.dto.resp;

import com.sikaryofficial.backend.constant.ProtocolTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.io.Serializable;
import java.util.Objects;

/**
 * 协议对象 protocol_t
 *
 * @author qinjinyuan
 * @date 2023-11-16
 */

@Getter
@Setter
@ToString
@ApiModel(value = "用户协议响应出参", description = "用户协议响应出参")
public class ProtocolDTO implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "协议ID")
    private Long protocolId;
    /**
     * 协议类型：1-用户协议,2-隐私协议
     */
    @ApiModelProperty(value = "协议类型：1-用户协议,2-隐私协议")
    private Integer protocolType;

    /**
     * 内容
     */
    @ApiModelProperty(value = "内容")
    private String content;

    private String protocolTypeDesc;

    public String getProtocolTypeDesc() {
        if (Objects.isNull(protocolType)) {
            return "";
        }
        if (Objects.isNull(ProtocolTypeEnum.getEnum(protocolType))) {
            return "";
        }
        return ProtocolTypeEnum.getEnum(protocolType).getDescription();
    }
}
